<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Route::namespace('Admin')->prefix('admin')->name('admin.')->group(function () {

    # 授权登录
    Route::post('auth/login', 'AuthController@login')->name('auth.login');

    # -- 需要权限验证的路由 start -------------------------------------------
    Route::middleware('auth:api')->group(function () {
        # 权限相关
        Route::post('auth/logout', 'AuthController@logout')->name('auth.logout');
        Route::post('auth/refresh', 'AuthController@refresh')->name('auth.refresh');
        Route::post('auth/me', 'AuthController@me')->name('auth.me');

        # 其他需要登录验证的路由
        Route::apiResources([
            'adminUsers'       => AdminUserController::class,
            'adminRoles'       => AdminRoleController::class,
            'adminPermissions' => AdminPermissionController::class,
            'adminMenus'       => AdminMenuController::class,
        ]);
    });
    # -- 需要权限验证的路由 end ---------------------------------------------
});
